import setStoreWithLS from '@/utils/setStoreWithLS'

export default {
    state: {
        token: '',
        role: 'guest',
        avatar: '',
        nickname: '',
        memo: '',
        account: '',
        test: {
            test: 'test'
        }
    },
    mutations: {
        SET_USERINFO: (state, userInfo) => {
            setStoreWithLS(state, _.pick(userInfo, ['avatar', 'nickname', 'memo', 'account']))  
            state.test.test = 'not test'
        },
        SET_TOKEN: (state, token) => {
            state.token = token
            localStorage.token = token
        },
        SET_ROLE: (state, role) => {
            state.role = role
            localStorage.role = role
        }
    },
    actions: {

    }
}
